package com.yonyou.pmclouds.task.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.yonyou.pmclouds.basecom.entity.SuperVO;
import com.yonyou.pmclouds.picture.entity.PictureViewVO;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Table(name = "pmbd_task")
@Getter
@Setter
public class TaskVO extends SuperVO{
	/**
	 *
	 */
	private static final long serialVersionUID = -8356942454089877892L;

	public static String PK_RECEIVER = "pk_receiver";
	public static String PK_SENDER = "pk_sender";
	public static String RECEIVER_NAME = "receiver_name";
	public static String SENDER_NAME = "sender_name";
	public static String TASKCREATOR = "taskcreator";
	public static String TASKCREATOR_NAME = "taskcreator_name";
	public static String TASK_STATUS = "task_status";
	public static String FINISHTIME = "finishtime";
	public static String BILLSTATUS = "billstatus";
	public static String LAST_V_FLAG = "last_v_flag";

	@Id
	private String pk_task;
	private String pk_project;
	private String taskcreator;
	private String pk_sender;
	private String pk_receiver;
	private String pk_bill;
	private String src_bill_type;
	private Date creationtime;
	private Date finishtime;
	private String task_status;
	private byte billstatus;
	private String pk_pretask;
	private String last_v_flag;
	private String billDescribe; //存放单据的重要描述字段(综合验收存的施工单位主键)

	@Transient
	private String project_name;
	@Transient
	private String receiver_name;
	@Transient
	private String sender_name;
	@Transient
	private String taskcreator_name;
	@Transient
	private List<String> pictures;
	@Transient
	private PictureViewVO[] picInfos;
	@Transient
	private String message;  //已处理任务列表，展示的信息

	@Transient
	@JsonUnwrapped
	private Map<String,Object> propMap;//个性化属性map，用于个性单据展示用

	@JsonIgnore
	public void addProp(String name , Object propValue){
		if(propMap == null)
			propMap = new HashMap<>();
		propMap.put(name, propValue);
	}
}
